using Light;
using Light.Assets.Scripts.EventManager;
using UnityEngine;

namespace Dream.OpenScene
{
    public class OpeningPanelController : MonoBehaviour
    {
        [SerializeField] private GameObject panel;

        public AudioClip bgm;

        public AudioListener listener;

        private void Start()
        {
            listener.enabled = true;
            AudioManager.Instance.setBGM(bgm);
        }

        /// <summary>
        ///     加载场景
        /// </summary>
        public void StartGame()
        {
            AudioManager.Instance.PauseBGM();

            listener.enabled = false;

            using var evt = LoadFirstSceneEvent.Get();

            EventManager.SendEvent(evt);

            panel.gameObject.SetActive(false);
        }

        public void AboutGame()
        {
            Debug.Log("出现制作组详情面板");
        }

        public void ExitGame()
        {
            Application.Quit();
        }
    }
}